//package com.smart.common.utils.arcSoft;
//
//import com.arcsoft.face.FaceEngine;
//import com.arcsoft.face.FaceFeature;
//import com.arcsoft.face.FaceInfo;
//import com.arcsoft.face.FaceSimilar;
//import com.arcsoft.face.toolkit.ImageInfo;
//
//import java.io.File;
//import java.util.ArrayList;
//import java.util.List;
//
//import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
//
//
//public class ArcSoftTemplate {
//    private FaceEngine faceEngine;
//    public ArcSoftTemplate(FaceEngine faceEngine){
//        this.faceEngine = faceEngine;
//    }
//
//    public boolean equals(File sourcefile,File file) {
//        int errorCode = 0;
//        //人脸检测
//        ImageInfo imageInfo = getRGBData(sourcefile);
//        List<FaceInfo> faceInfoList = new ArrayList<FaceInfo>();
//        errorCode = faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
//        System.out.println(faceInfoList);
//
//        //特征提取
//        FaceFeature faceFeature = new FaceFeature();
//        errorCode = faceEngine.extractFaceFeature(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList.get(0), faceFeature);
//        System.out.println("特征值大小：" + faceFeature.getFeatureData().length);
//
//        //人脸检测2
//        ImageInfo imageInfo2 = getRGBData(file);
//        List<FaceInfo> faceInfoList2 = new ArrayList<FaceInfo>();
//        errorCode = faceEngine.detectFaces(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(),imageInfo2.getImageFormat(), faceInfoList2);
//        System.out.println(faceInfoList2);
//
//        //特征提取2
//        FaceFeature faceFeature2 = new FaceFeature();
//        errorCode = faceEngine.extractFaceFeature(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(), imageInfo2.getImageFormat(), faceInfoList2.get(0), faceFeature2);
//        System.out.println("特征值大小：" + faceFeature2.getFeatureData().length);
//
//        //特征比对
//        FaceFeature targetFaceFeature = new FaceFeature();
//        targetFaceFeature.setFeatureData(faceFeature.getFeatureData());
//        FaceFeature sourceFaceFeature = new FaceFeature();
//        sourceFaceFeature.setFeatureData(faceFeature2.getFeatureData());
//        FaceSimilar faceSimilar = new FaceSimilar();
//
//        errorCode = faceEngine.compareFaceFeature(targetFaceFeature, sourceFaceFeature, faceSimilar);
//        float score = faceSimilar.getScore();
//        System.out.println("相似度：" + score);
//        return score>0.85F;
//    }
//
//    /**
//     * 关闭引擎
//     * @return
//     */
//    public int close(){
//        //引擎卸载
//        return this.faceEngine.unInit();
//    }
//}
